<?php
//decode by QQ:735674691 http://bbs.yaoduoli.com/

/**
 * ============================================================================
 * 版权所有  邀多利保留所有权利  如有倒卖一律取消售后更新服务。
 * 网站地址: http://bbs.yaoduoli.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用；
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/

if(!defined('ADMIN')){
	exit('Access Denied');
}
/*function allow_doamin() {
    $is_allow    = false;
    $SERVER_NAME = trim($_SERVER['SERVER_NAME']);
    $url         = 'http://www.yaoduoli.com/miaozhewap.php?doamin=' . $SERVER_NAME;
    $result      = get_Contact($url, 10, 'get', true);
    $result      = json_decode($result, true);
    if ($result['code'] == 200) {
        $is_allow = true;
    } else {
        $is_allow = false;
    }
    if (!$is_allow) {
      die('<div class="sqm"><table width="600" height="376" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="570" style="font-size:18px; font-weight:bold;"><div class="sqm">很抱歉，您的域名还未授权哦,请先购买模板授权<a href="http://www.yaoduoli.com/code/view63.html" target="_blank"><font color="#FF0000" style="font-size:16px; font-weight:bold;"> 全自动购买授权</font></a></br></br></br>联系客服QQ授权 <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=735674691&amp;site=qq&amp;menu=yes" target="_blank"><img border="0" src="http://wpa.qq.com/pa?p=2:735674691:41" alt="联系客服购买授权" title="联系客服购买授权" style="vertical-align:top"></a></div></td>
  </tr>
</table>
');
    
    }
}
allow_doamin();
//远程请求*/
function get_Contact($url, $timeout = 3, $method = "get", $ssl = false) {
    if (!function_exists('file_get_contents')) {
        ini_set('user_agent', 'MISE 6.0');
        $ct            = stream_context_create(array('http' => array('timeout' => $timeout, "method" => $method)));
        $file_contents = file_get_contents($url, 0, $ct);
    } else {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_USERAGENT, "MISE 6.0");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $file_contents = curl_exec($ch);
        if (curl_errno($ch)) {
            $file_contents = 'curl_error';
        }
        curl_close($ch);
    }
    return $file_contents;
}
if($_POST['sub']!=''){
	$moban_name='wap_'.$_GET['tpl'];
	unset($_POST['sub']);
	unset($_POST['tpl']);
	
	$tpl_data=(array)dd_unxuliehua($duoduo->select('tpl','data','title="'.$moban_name.'"'));
	foreach($_POST as $k=>$v){
		$tpl_data[$k]=$v;
	}
	
	$data=array('title'=>$moban_name,'data'=>dd_xuliehua($tpl_data));
	$tpl_id=(int)$duoduo->select('tpl','id','title="'.$moban_name.'"');
	if($tpl_id==0){
		$duoduo->insert('tpl',$data);
	}
	else{
		$duoduo->update('tpl',$data,'id="'.$tpl_id.'"');
	}
	
	dd_set_cache('tpl/'.$moban_name,$_POST);
	jump(-1,'设置完成');
}
else{
	$moban_name='wap_'.MOBAN_NAME;
	$tpl_data=$duoduo->select('tpl','data','title="'.$moban_name.'"');
	$tpl_data=(array)dd_unxuliehua($tpl_data);
}
?>
<style type="text/css">
.yanse{border:0px solid #ddd;border-collapse:collapse; height:45px;font-size:14px}
.STYLE1 {color: #FF0000}
</style>
<form action="<?=$action_url?>" method="post" name="form1">
<table id="addeditable" border=1 cellpadding=0 cellspacing=0 style="font-size:14px" bordercolor="#dddddd">
   <tr style="height:55px; margin:5px">
    <td align="right">模版颜色：</td>
    <td width="888">
    <table border="0" class="yanse" style="margin-left:5px">
    <tr>
    <td style="margin-left:15px">&nbsp;<input name="color" value="<?=$tpl_data['color']?$tpl_data['color']:'#EC1A5B'?>" style="width:100px; height:30px"/> </td>
    <?=seban()?>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;适用于wap页有头底部颜色,如需自定义请自行填写颜色代码</td>
  </tr>
</table>
 </td>
  </tr>
   <tr style="height:45px;">
        <td align="right">首页商品板块标识码：</td>
        <td>&nbsp;</br>&nbsp;&nbsp;<input name="bsm" value="<?=$tpl_data['bsm']?$tpl_data['bsm']:''?>"/ style=" width:100px; height:30px">&nbsp;&nbsp;&nbsp;<span class="zhushi">首页商品下调用哪个板块，请填写栏目标识码：如优惠券：quan</span></br>&nbsp;</td>
    </tr>
  <tr>
   <tr style="height:45px;">
        <td align="right">首页商数量：</td>
        <td>&nbsp;</br>&nbsp;&nbsp;<input name="shuliang" value="<?=$tpl_data['shuliang']?$tpl_data['shuliang']:''?>"/ style=" width:100px; height:30px">&nbsp;&nbsp;&nbsp;<span class="zhushi">首页多少件商品</span></br>&nbsp;</td>
    </tr>
  <tr>
   <tr style="height:45px;">
        <td align="right">首页登录开关：</td>
        <td>&nbsp;&nbsp;<label>
<input <?php if($tpl_data['dl-kg']['open']==0){?> checked="checked"<?php }?> name="dl-kg[open]" type="radio" value="0"/>&nbsp;开启</label>
 &nbsp;<label><input <?php if($tpl_data['dl-kg']['open']==1){?> checked="checked"<?php }?> name="dl-kg[open]" type="radio" value="1"/>&nbsp;关闭</label> </td>
 </tr>
   <tr style="height:45px;">
        <td align="right">首页主栏目：</td>
        <td>&nbsp;&nbsp;<label>
<input <?php if($tpl_data['fllm-kg']['open']==0){?> checked="checked"<?php }?> name="fllm-kg[open]" type="radio" value="0"/>&nbsp;默认分类栏目</label>
 &nbsp;<label><input <?php if($tpl_data['fllm-kg']['open']==1){?> checked="checked"<?php }?> name="fllm-kg[open]" type="radio" value="1"/>&nbsp;自定义栏目</label> </td>
 </tr>
   <tr style="height:45px;">
        <td align="right">模板类型：</td>
        <td>&nbsp;&nbsp;<label>
<input <?php if($tpl_data['fl-kg']['open']==0){?> checked="checked"<?php }?> name="fl-kg[open]" type="radio" value="0"/>&nbsp;显示返利金额</label>
 &nbsp;<label><input <?php if($tpl_data['fl-kg']['open']==1){?> checked="checked"<?php }?> name="fl-kg[open]" type="radio" value="1"/>&nbsp;显示商品销量</label> </td>
 </tr>
   <tr style="height:45px;">
        <td align="right">底部导航：</td>
        <td>&nbsp;&nbsp;<label>
<input <?php if($tpl_data['foot-kg']['open']==0){?> checked="checked"<?php }?> name="foot-kg[open]" type="radio" value="0"/>&nbsp;开启</label>
 &nbsp;<label><input <?php if($tpl_data['foot-kg']['open']==1){?> checked="checked"<?php }?> name="foot-kg[open]" type="radio" value="1"/>&nbsp;关闭</label> </td>
    </tr>
    </tr>
    <tr>
        <td align="right">预载图片：</td>
        <td>&nbsp;</br>&nbsp;</br>&nbsp;&nbsp;<input name="loading_img" type="text" value="<?=$tpl_data['loading_img']?>" id="loading_img" class="btn3" style="width:300px; height:30px" /> <input class="sub" type="button" value="上传预载图片" onclick="javascript:openpic('<?=u('fun','upload',array('uploadtext'=>'loading_img','do'=>'httpurl','sid'=>session_id()))?>','upload','450','350')" /></br>&nbsp;</br>&nbsp;&nbsp; <span class="zhushi">根据模版预载图片实际尺寸上传，格式不限。默认大小：160px*160px，可gif</span></br>&nbsp;</br>&nbsp;&nbsp;
        </td>
    </tr>
  <tr>
    <td align="right">底部版权：</td>
    <td style="padding-left:15px">&nbsp;<textarea name="banquan" id="content" style="width:480px; margin-left:5px;"><?=$tpl_data['banquan']?></textarea>&nbsp;<span class="zhushi">如：Copyright ©2008-2014 XXXX版权所有</span></br>&nbsp;&nbsp;</td>
  </tr>
   <tr style="height:45px;">
    <td align="right">查看页面：</td>
    <td style="padding-left:15px">&nbsp;&nbsp;<span class="zhushi"><a href="/m/index.php?mod=inc&amp;act=app" target="_blank">查看app下载地址</a></span><a href="/m/index.php?mod=inc&amp;act=app">&nbsp;</a></td>
  </tr>
  
    <tr style="height:45px;">
        <td align="right">优多APP开关：</td>
        <td>&nbsp;<?=html_radio($zhuangtai_arr,$tpl_data['vipduoapp_open'],'vipduoapp_open')?> </td>
    </tr>
<tr style="height:45px;">
    <td align="right">安卓app下载地址：</td>
    <td style="padding-left:15px">&nbsp;<input name="apkurl" value="<?=$tpl_data['apkurl']?$tpl_data['apkurl']:''?>" style=" margin-top:10px;width:400px; height:30px">&nbsp;<span class="zhushi">安卓app下载地址</span></br>&nbsp;&nbsp;</td>
  </tr>
 <tr style="height:45px;">
    <td align="right">苹果app下载地址：</td>
    <td style="padding-left:15px">&nbsp;<input name="ipaurl" value="<?=$tpl_data['ipaurl']?$tpl_data['ipaurl']:''?>" style=" margin-top:10px;width:400px; height:30px">&nbsp;<span class="zhushi">苹果app下载地址</span></br>&nbsp;&nbsp;</td>
  </tr>
   
    <tr>
     <td align="right">&nbsp;</td>
     <td>&nbsp;<input type="submit" name="sub" value=" 保 存 设 置 " /></td>
  </tr>
  </table>
</form>